package com.feisi.service.impl;

import com.feisi.dao.ClueDao;
import com.feisi.domain.Clue;
import com.feisi.service.ClueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 线索业务层
 */
@Service
public class ClueServiceImpl implements ClueService {

    @Autowired
    private ClueDao clueDao;

    @Override
    public List<Clue> findAll(Integer page, Integer limit) {
        List<Clue> clues = clueDao.findAll(page, limit);
        return clues;
    }

    @Override
    public Integer cluesTotal() {
        Integer cluesTotal = clueDao.cluesTotal();
        return cluesTotal;
    }

    @Override
    public List<Clue> findByName(String cl_name, Integer page, Integer limit) {
        List<Clue> clues = clueDao.findByName(cl_name, page, limit);
        return clues;
    }


    @Override
    public Integer cluesTotalByName(String cl_name) {
        Integer cluesTotalByName = clueDao.cluesTotalByName(cl_name);
        return cluesTotalByName;
    }

    @Override
    public List<Clue> findByUserid(Integer userid, Integer page, Integer limit) {
        List<Clue> clues = clueDao.findByUserid(userid, page, limit);
        return clues;
    }

    @Override
    public Integer clueTotalByUserid(Integer userid) {
        Integer clueTotalByUserid = clueDao.clueTotalByUserid(userid);
        return clueTotalByUserid;
    }

    @Override
    public void saveClue(Clue clue) {
        clueDao.saveClue(clue);
    }

    @Override
    public void deleteClue(Integer[] ids) {
        clueDao.deleteClue(ids);
    }

    @Override
    public void updateClue(Clue clue) {
        clueDao.updateClue(clue);
    }

    @Override
    public Clue findById(Integer id) {
        Clue clue =  clueDao.findById(id);
        return clue;
    }
}
